﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace ScriptEditor.Commands
{
    class Command_CharAlpha : Command
    {
        public string name
        {
            get
            {
                return Value1;
            }
            set
            {
                Value1 = value;
            }
        }
        public float duration
        {
            get
            {
                return float.TryParse(Value2, out float result) ? result : 0.5f;
            }
            set
            {
                Value2 = value.ToString();
            }
        }
        public float alpha
        {
            get
            {
                return float.TryParse(Value3, out float result) ? result : 1;
            }
            set
            {
                Value3 = value.ToString();
            }
        }
        public Command_CharAlpha()
        {
            CommandType = COMMANDTYPE.CharAlpha;
            name = "请输入角色名";
            duration = 0.5f;
            alpha = 0f;
            Wait = true;
        }
        public Command_CharAlpha(string Name, float Duration, float Alpha)
        {
            CommandType = COMMANDTYPE.CharAlpha;
            name = Name;
            duration = Duration;
            alpha = Alpha;
            Wait = true;
        }
        public override string ToString()
        {
            return CommandType.ToString() + ":\n" + "改变角色透明度:" + name + "为" + alpha.ToString();
        }
    }
}
